#[macro_use] extern crate log;
extern crate env_logger;
extern crate fejpsl_contract;
extern crate actix_web;

mod endpoints;
use endpoints::*;
use actix_web::{App, HttpServer};

#[actix_rt::main]
async fn main() -> std::io::Result<()> {

    std::env::set_var("RUST_LOG", "actix_server=info,actix_web=info");
    env_logger::init();

    info!("Rust Actix Server running... http://localhost:8080/");
    HttpServer::new(|| App::new()
        .service(index)
        //轮播图管理
        .service(list_banner)
        .service(insert_banner)
        .service(get_banner_by_id)
        .service(delete_banner_by_id)
        //文章管理
        .service(top_list_article)
        .service(get_article_list_by_page_no)
        //好友管理
        .service(messager_list)
        .service(friend_message_list)
        .service(list_my_follow)
        .service(list_follow_me)
        .service(list_block_people)
        //用户管理
        .service(get_user_by_id)
        .service(get_user_by_uuid)
        .service(user_register)
        .service(user_login)
        .service(update_user_by_id)
        .service(update_user_avatar)
        .service(update_user_phone)
        .service(update_user_email)
        .service(update_user_birthday)
        .service(update_user_sex)
        //.service(update_user_is_explicit)
        .service(update_user_nice_name)
        .service(update_user_real_name)
        .service(update_user_area)
        //上墙管理
        .service(get_wall_list_by_page_no)
        .service(get_wall_reader_list_by_wall_id)
        .service(get_wall_comment_list_by_page_no)
        //rank
        .service(get_rank_fan_list_by_page_no)
        .service(get_rank_friend_level_score_list_by_page_no)
        .service(get_rank_world_level_score_list_by_page_no)
        //exam
        .service(get_paper_list_by_page_no)
        .service(get_paper_list_by_category)
        .service(get_paper_text_content_by_subject_id)
        .service(get_single_answer_by_id)
        .service(list_single_answer)
        .service(get_multiple_answer_by_id)
        .service(list_multiple_answer)
        .service(get_true_false_question_by_id)
        .service(list_true_false_question)
        .service(get_blank_filling_question_by_id)
        .service(list_blank_filling_question)
        //china province,city
        .service(get_province_list)
        .service(get_city_list)
        //community community
        .service(get_my_room_list_by_page_no)
        .service(get_hot_room_list_by_page_no)
        .service(create_room)
        .service(join_room)
        .service(delete_room)
        .service(get_room_table_list_by_page_no)
    )
        .bind("127.0.0.1:8080")?
        .run()
        .await
}